<template>

    <div class="main">
    <!-- <button @click="changeWebview">webview</button> -->
        <div >
            <input type="text" ref="input" class="input">
            <button class="btn" @click="changeWebview">确定</button>
        </div>

        <web class="webview" id="webview" ref="webview" src="https://blog.csdn.net/weixin_38069018/article/details/118366126">    </web>
    </div>
</template>

<script>
import {fetchRequest} from '../utils/fetch'

export default{
  name: 'WXwebview',
  methods: {
    changeWebview () {
      var inputEl = this.$refs.input
      var inputVal = inputEl.values
      console.log(inputVal)
      console.log(inputEl)
      //   if (inputVal) {
      var webElement = this.$refs.webview
      console.log('webElement', webElement)
      webElement.$options.propsData.src = 'www.baidu.com'
      var webview = weex.requireModule('webview')
      webview.goBack(webElement.ref)
    //   }
    },
    fecthPost () {
      console.log('fetch')
      fetchRequest('/web/bar', 'POST', { answer: 42 }).then((data) => {
        console.log(data)
      })
    }
  }
}
</script>
<style scoped>
    .webview{
        height: 1500px;
    }
    .input{
        height: 60px;
        width: 400px;
        border: 1px solid black;
        display: inline-block;
    }
    .btn{
        height: 60px;
        width: 100px;
        border-radius: 5px;
        font-size: large;
        background-color: antiquewhite;

    }

</style>
